This invention relates generally to object-oriented application development, and more particularly to dynamically generating tag-based code from object-oriented code.
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. The following notice applies to the software and data as described below and in the drawings hereto: Copyright(copyright) 1997, Microsoft, All Rights Reserved.
Internet application development includes techniques and methods that differ from traditional object-oriented application development.
One method of Internet application development utilizes a tag-based display language such as a Hyper Text Markup Language (HTML). However, the static nature of HTML pages makes interactive components for World Wide Web (Web) pages difficult to build and to reuse. Another method of Internet application development utilizes Dynamic HTML (DHTML). DHTML provides for interactive components through a combination of HTML, script code and a document object model. The script code allows web authors to write source code that manipulates items displayed by a web browser.
Object-oriented programming languages, such as the Java programming language, are different from scripting languages. Traditional software developers are frequently more accustomed to using an object-oriented programming model rather than an Internet programming model. In order to develop Internet applications then, traditional software developers must learn a tag-based display language such as DHTML. However, having to learn a new language reduces software development productivity.
Therefore, there is a need for a system that enables object-oriented programmers to generate tag-based procedural code without having to learn a new language. There is also a need for a system that allows software developers to generate Dynamic HTML while writing programs in the Java programming language.
The above-mentioned shortcomings, disadvantages and problems are addressed by the present invention, which will be understood by reading and studying the following specification. The present invention allows objected oriented programmers, such as those writing in the Java programming language, to write object-oriented code normally as if they were writing to any user interface framework. The present invention converts the code into standard tag-based procedural code, such as HTML or eXtensible Markup Language (XML), for display on a selected Internet web browser or other selected browser and to generate generic HTML if so indicated by the developer.
The programmer creates and manipulates objects that correspond to components of a web page. The objects have an attribute referred as key value pairs. Key value pairs for an object are maintained in arrays and are used to generate styles and attributes, which are further used to generate HTML for desired web browsers. Examples of styles and attributes include color: red, font: bold, etc. The use of the key value pair data structure facilitates the ease of plugging in different HTML generators or other tag-based language generators to perform the conversion in an objected oriented development environment.
In one embodiment, several states are used when Java code is being written for display of HTML directly on a browser to aid in its generation and modification. An xe2x80x9cunboundxe2x80x9d state is used until HTML for an element is sent to the browser. When the browser has received the element""s corresponding HTML, the element internally moves to a xe2x80x9cpeer availablexe2x80x9d state. If the element""s xe2x80x9cpeerxe2x80x9d interface is retrieved from the browser, the state becomes xe2x80x9cboundxe2x80x9d, which indicates the element is associated with a xe2x80x9cpeerxe2x80x9d inside the browser. During the xe2x80x9cboundxe2x80x9d state the key value pairs are no longer maintained and any changes in properties or attributes are sent directly to the xe2x80x9cpeerxe2x80x9d. In one embodiment, elements are returned from xe2x80x9cboundxe2x80x9d to xe2x80x9cunboundxe2x80x9d when elements are removed from the document. The states and movement between them are transparent to the programmer, as they are handled internally by a library or set of development tools.
The present invention describes computers, systems, methods, and computer-readable media of varying scope. In addition to the aspects and advantages of the present invention described in this summary, further aspects and advantages of the invention will become apparent by reference to the drawings and by reading the detailed description that follows.